package com.sl.au.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sl.au.entity.CustomerPayInfo;
import com.sl.au.entity.SaleArea;
import com.sl.au.repository.EXDECustomerPayInfoRepository;
import com.sl.au.service.EXDECustomerPayInfoService;
@Service("EXDECustomerPayInfoService")
@Transactional
public class EXDECustomerPayInfoServiceImpl extends BaseServiceImpl implements EXDECustomerPayInfoService{
	@Autowired
	EXDECustomerPayInfoRepository exdeCustomerPayInfoRepository;
	@Override
	public EXDECustomerPayInfoRepository getEXDECustomerPayInfoRepository() {
		// TODO Auto-generated method stub
		return exdeCustomerPayInfoRepository;
	}

	@Override
	public List<CustomerPayInfo> getMyPage(int start, int length, String CustomerId,String key) {
		Page<CustomerPayInfo> pages=null;
		Pageable pageable=new PageRequest(start/length,length,Sort.Direction.DESC,"createTime");//排序
		pages=exdeCustomerPayInfoRepository.findAllTrance(CustomerId,key,pageable);
		// TODO Auto-generated method stub
		return pages.getContent();
	}

	@Override
	public long getMyPageCount(int start, int length, String CustomerId,String key) {
		// TODO Auto-generated method stub
		long pagesCount = 0;
		pagesCount = exdeCustomerPayInfoRepository.getCount(CustomerId,key);
		return pagesCount;
	}
	@Override
	public void saveCustomer(String CustomerId, String identification, String invoicePhone, String zipCode,
			String invoiceAddress, String invoiceBank, String bankAccount, String taxNumber, String invoiceMemo,
			String postUnit,String postDelegate,String postPhone,String postAddress,String postZip
			,String business,String superior,String address,String customerName,String customerCode
			) {
//		// TODO Auto-generated method stub
//		CustomerPayInfo customerPayInfo = new CustomerPayInfo();
//		customerPayInfo.setCustomerId(CustomerId);
//		customerPayInfo.setIdentification(identification);
//		customerPayInfo.setInvoicePhone(invoicePhone);
//		customerPayInfo.setZipCode(zipCode);
//		customerPayInfo.setInvoiceAddress(invoiceAddress);
//		customerPayInfo.setInvoiceBank(invoiceBank);
//		customerPayInfo.setBankAccount(bankAccount);
//		customerPayInfo.setTaxNumber(taxNumber);
//		customerPayInfo.setInvoiceMemo(invoiceMemo);
//		customerPayInfo.setPostUnit(postUnit);
//		customerPayInfo.setPostDelegate(postDelegate);
//		customerPayInfo.setPostPhone(postPhone);
//		customerPayInfo.setPostAddress(postAddress);
//		customerPayInfo.setPostZip(postZip);
//		customerPayInfo.setBusiness(business);
//		customerPayInfo.setSuperior(superior);
//		customerPayInfo.setAddress(address);
//		customerPayInfo.setCustomerName(customerName);
//		customerPayInfo.setCustomerCode(customerCode);
//		//customerPayInfo.setSaleArea(saleArea);
//		exdeCustomerPayInfoRepository.save(customerPayInfo);
	}
}
